/*
J 1
It is the first problem.
Good luck, let's go.
--  GD-00114  dengziyue  Xintang NO.3 Middle School
--  Writed it at 08:44
*/
#include<cstdio>
#include<cstring>
using namespace std;
long long n;
long long l;
long long r;
int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%lld%lld%lld",&n,&l,&r);
	if(r/n==l/n)printf("%lld\n",r%n);
	else printf("%lld\n",n-1);
	return 0;
}
